#include <stdio.h>
#include <time.h>

/*
 * 字节型数组
 */

int main()
{
	struct tm t;
	time_t unix_time;
	int i=0, j=0;

	unix_time = time(NULL);

	localtime_r(&unix_time, &t);

	for (i = 0; i < 9; i++) {
		for (j = 0; j < 4; j++)
			printf("0x%02X ", ((unsigned char *)&t)[i*4+j]);
		
		printf("\n");
	}

	return 0;
}

#if 0
/*
 * intel
 */
00000000000011c9 <main>:
    11c9:	f3 0f 1e fa          	endbr64 
    11cd:	55                   	push   %rbp
    11ce:	48 89 e5             	mov    %rsp,%rbp
    11d1:	48 83 ec 50          	sub    $0x50,%rsp
    11d5:	64 48 8b 04 25 28 00 	mov    %fs:0x28,%rax
    11dc:	00 00 
    11de:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
    11e2:	31 c0                	xor    %eax,%eax
    11e4:	c7 45 b0 00 00 00 00 	movl   $0x0,-0x50(%rbp)
    11eb:	c7 45 b4 00 00 00 00 	movl   $0x0,-0x4c(%rbp)
    11f2:	bf 00 00 00 00       	mov    $0x0,%edi
    11f7:	e8 d4 fe ff ff       	callq  10d0 <time@plt>
    11fc:	48 89 45 b8          	mov    %rax,-0x48(%rbp)
    1200:	48 8d 55 c0          	lea    -0x40(%rbp),%rdx
    1204:	48 8d 45 b8          	lea    -0x48(%rbp),%rax
    1208:	48 89 d6             	mov    %rdx,%rsi
    120b:	48 89 c7             	mov    %rax,%rdi
    120e:	e8 8d fe ff ff       	callq  10a0 <localtime_r@plt>
    1213:	c7 45 b0 00 00 00 00 	movl   $0x0,-0x50(%rbp)		// x=0
    121a:	eb 52                	jmp    126e <main+0xa5>		// for x
    121c:	c7 45 b4 00 00 00 00 	movl   $0x0,-0x4c(%rbp)		// y=0
    1223:	eb 35                	jmp    125a <main+0x91>		// for y
    1225:	8b 45 b0             	mov    -0x50(%rbp),%eax
    1228:	8d 14 85 00 00 00 00 	lea    0x0(,%rax,4),%edx	// edx=x*4+0x0
    122f:	8b 45 b4             	mov    -0x4c(%rbp),%eax		// eax=y
    1232:	01 d0                	add    %edx,%eax			
    1234:	48 98                	cltq						// rax=y+x*4
    1236:	48 8d 55 c0          	lea    -0x40(%rbp),%rdx		// rdx=rbp-0x40
    123a:	48 01 d0             	add    %rdx,%rax			// rax=rbp-0x40+x*4+y
    123d:	0f b6 00             	movzbl (%rax),%eax			// eax=(rbp-0x40+x*4+y)
    1240:	0f b6 c0             	movzbl %al,%eax				// eax=al
    1243:	89 c6                	mov    %eax,%esi
    1245:	48 8d 3d b8 0d 00 00 	lea    0xdb8(%rip),%rdi        # 2004 <_IO_stdin_used+0x4>
    124c:	b8 00 00 00 00       	mov    $0x0,%eax
    1251:	e8 6a fe ff ff       	callq  10c0 <printf@plt>	
    1256:	83 45 b4 01          	addl   $0x1,-0x4c(%rbp)		// y++
    125a:	83 7d b4 03          	cmpl   $0x3,-0x4c(%rbp)		// y-0x3
    125e:	7e c5                	jle    1225 <main+0x5c>		// for y
    1260:	bf 0a 00 00 00       	mov    $0xa,%edi
    1265:	e8 26 fe ff ff       	callq  1090 <putchar@plt>
    126a:	83 45 b0 01          	addl   $0x1,-0x50(%rbp)		// x++
    126e:	83 7d b0 08          	cmpl   $0x8,-0x50(%rbp)		// x-0x8
    1272:	7e a8                	jle    121c <main+0x53>		// for x
    1274:	b8 00 00 00 00       	mov    $0x0,%eax
    1279:	48 8b 4d f8          	mov    -0x8(%rbp),%rcx
    127d:	64 48 33 0c 25 28 00 	xor    %fs:0x28,%rcx
    1284:	00 00 
    1286:	74 05                	je     128d <main+0xc4>
    1288:	e8 23 fe ff ff       	callq  10b0 <__stack_chk_fail@plt>
    128d:	c9                   	leaveq 
    128e:	c3                   	retq   
    128f:	90                   	nop

/*
 * arm
 */
000000000040064c <main>:
  40064c:	a9ba7bfd 	stp	x29, x30, [sp, #-96]!
  400650:	910003fd 	mov	x29, sp
  400654:	b9005fbf 	str	wzr, [x29, #92]
  400658:	b9005bbf 	str	wzr, [x29, #88]
  40065c:	d2800000 	mov	x0, #0x0                   	// #0
  400660:	97ffffa4 	bl	4004f0 <time@plt>
  400664:	f9000fa0 	str	x0, [x29, #24]
  400668:	910083a1 	add	x1, x29, #0x20
  40066c:	910063a0 	add	x0, x29, #0x18
  400670:	97ffff9c 	bl	4004e0 <localtime_r@plt>
  400674:	b9005fbf 	str	wzr, [x29, #92]
  400678:	1400001a 	b	4006e0 <main+0x94>
  40067c:	b9005bbf 	str	wzr, [x29, #88]
  400680:	14000010 	b	4006c0 <main+0x74>
  400684:	b9405fa0 	ldr	w0, [x29, #92]
  400688:	531e7401 	lsl	w1, w0, #2
  40068c:	b9405ba0 	ldr	w0, [x29, #88]
  400690:	0b000020 	add	w0, w1, w0
  400694:	93407c00 	sxtw	x0, w0
  400698:	910083a1 	add	x1, x29, #0x20
  40069c:	8b000020 	add	x0, x1, x0
  4006a0:	39400000 	ldrb	w0, [x0]
  4006a4:	2a0003e1 	mov	w1, w0
  4006a8:	90000000 	adrp	x0, 400000 <_init-0x4a8>
  4006ac:	911ea000 	add	x0, x0, #0x7a8
  4006b0:	97ffffa0 	bl	400530 <printf@plt>
  4006b4:	b9405ba0 	ldr	w0, [x29, #88]
  4006b8:	11000400 	add	w0, w0, #0x1
  4006bc:	b9005ba0 	str	w0, [x29, #88]
  4006c0:	b9405ba0 	ldr	w0, [x29, #88]
  4006c4:	71000c1f 	cmp	w0, #0x3
  4006c8:	54fffded 	b.le	400684 <main+0x38>
  4006cc:	52800140 	mov	w0, #0xa                   	// #10
  4006d0:	97ffff9c 	bl	400540 <putchar@plt>
  4006d4:	b9405fa0 	ldr	w0, [x29, #92]
  4006d8:	11000400 	add	w0, w0, #0x1
  4006dc:	b9005fa0 	str	w0, [x29, #92]
  4006e0:	b9405fa0 	ldr	w0, [x29, #92]
  4006e4:	7100201f 	cmp	w0, #0x8
  4006e8:	54fffcad 	b.le	40067c <main+0x30>
  4006ec:	52800000 	mov	w0, #0x0                   	// #0
  4006f0:	a8c67bfd 	ldp	x29, x30, [sp], #96
  4006f4:	d65f03c0 	ret

#endif

